package io.github.eric.urpc.core.rpc;

import java.io.Serializable;
import java.util.UUID;

public abstract class Message implements Serializable {
    private final String traceId;
    private final long createdAt;
    private long sendAt;
    //有序线程使用的key
    private String orderedThreadKey;

    public Message() {
        this.traceId = UUID.randomUUID().toString();
        this.createdAt = System.currentTimeMillis();
    }

    public final long getCreatedAt() {
        return createdAt;
    }

    public final long getSendAt() {
        return sendAt;
    }

    public final void setSendAt(long sendAt) {
        this.sendAt = sendAt;
    }

    public final String getTraceId() {
        return traceId;
    }

    public String getOrderedThreadKey() {
        return orderedThreadKey;
    }

    public void setOrderedThreadKey(String orderedThreadKey) {
        this.orderedThreadKey = orderedThreadKey;
    }
}
